package com.whz.builder;

import java.util.Objects;

/**
 * @Author: sinosoft
 * @Description:
 * @Date: Create in 20:53 2021/4/27
 * @Modified By:
 */
public class NyPizza extends Pizza {
    public enum Size { SMALL, MEDIUM, LARGE }
    private final Size size;
    public static class Builder extends Pizza.Builder<Builder> {
        private final Size size;
        public Builder(Size size) {
            this.size = Objects.requireNonNull(size);
        }
        @Override
        public NyPizza build() {
            return new NyPizza(this);
        }
        @Override
        protected Builder self() {
            return this;
        }
    }
    private NyPizza(Builder builder) {
        super(builder);
        size = builder.size;
    }

    @Override
    public String toString() {
        return "NyPizza{" +
                "尺寸 = " + size +
                ", 配方 = " + toppings +
                '}';
    }
}
